package 多线程.CountDownLatchDemo;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

/**
 * @author : K k
 * @date : 21:17 2020/9/14
 */
public class Boss implements Runnable {

    private CountDownLatch downLatch;

    public Boss(CountDownLatch downLatch){
        this.downLatch = downLatch;
    }

    @Override
    public void run() {
        System.out.println("老板正在等所有的工人干完活......");
        try {
            this.downLatch.await(4, TimeUnit.SECONDS);
        } catch (InterruptedException e) {
        }finally {
            System.out.println("老板开始检查了！");
        }
    }

}
